using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for CheckUser
/// </summary>
public class CheckUser
{
	public CheckUser()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public static bool Valid(Page ThePage)
    {
        if (ThePage.Session["gcLOGIN_OK"] == null)
        {
            ThePage.Session["gcprePage"] = ThePage.Request.Url.OriginalString;
            ThePage.Response.Redirect("../Default.aspx");
            return false;
        }
        if (ThePage.Session["gcUsername"] == null || !(bool)ThePage.Session["gcLOGIN_OK"])
        {
            ThePage.Session["gcprePage"] = ThePage.Request.Url.OriginalString;
            ThePage.Response.Redirect("../Default.aspx");
            return false;
        }
        return true;
    }
}
